#!/bin/bash

# time
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

# locale
sed -i '/^#en_US\.UTF-8 UTF-8/s/^#//' /etc/locale.gen
sed -i '/^#zh_CN\.UTF-8 UTF-8/s/^#//' /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" >/etc/locale.conf

# hostname
echo "archlinux" >/etc/hostname

# grub efi
pacman -S grub efibootmgr strace man git --noconfirm
# grub-install --efi-directory=/boot --target=arm64-efi
# grub-install /dev/sda --efi-directory=/boot
grub-install --efi-directory=/boot
grub-mkconfig -o /boot/grub/grub.cfg

# user & passwd
echo "root:qwer" | chpasswd
useradd -m -s /bin/bash jacky
echo "jacky:qwer" | chpasswd

# NetworkManager sshd
systemctl enable NetworkManager
systemctl enable sshd

# sudo nopasswd
echo "$(id -nu 1000) ALL=(ALL) NOPASSWD:ALL" | tee /etc/sudoers.d/user_nopasswd >/dev/null

# default editor
echo '[ -x "/usr/bin/nvim" ] && export EDITOR="/usr/bin/nvim"' | tee /etc/profile.d/default_editor.sh >/dev/null

# console font
bash -c "$(curl -fsSl https://gitee.com/hevey88/install_script/raw/main/arch_change_console_font.sh)"

# bash -c "$(curl -fsSL https://gitee.com/hevey88/install_script/raw/main/arch_chroot.sh)"
# parallels desktop vm.bios.efi=0
